Skip to content

Implement Minecraft version migration tool using OpenRewrite framework - #1

Merged
TimeBather merged 3 commits into
mainfrom
copilot/fix-0c0266c1-03ac-4231-b1ab-96c6538ed57a
Aug 20, 2025
Merged

Implement Minecraft version migration tool using OpenRewrite framework#1
TimeBather merged 3 commits into
mainfrom
copilot/fix-0c0266c1-03ac-4231-b1ab-96c6538ed57a

Conversation

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown

This PR implements a comprehensive Minecraft version migration tool using the OpenRewrite framework. The tool automatically updates Minecraft project files when migrating between different Minecraft versions.

Features

  • Build script updates: Automatically updates version strings in build.gradle files, including:

    • Dependency versions (e.g., net.neoforged:neoforge:1.20.1-47.1.0net.neoforged:neoforge:1.21-47.1.0)
    • Minecraft version assignments (e.g., version = '1.20.1'version = '1.21')
    • Mappings versions (e.g., mappings = 'official_1.20.1'mappings = 'official_1.21')
  • Properties file updates: Updates version strings in gradle.properties files, including:

    • Direct version properties (minecraft_version=1.20.1minecraft_version=1.21)
    • Composite version strings (fabric_version=0.67.0+1.20.1fabric_version=0.67.0+1.21)
    • Platform-specific versions (neoforge_version=1.20.1-47.1.0neoforge_version=1.21-47.1.0)

Configuration

The recipe accepts two parameters:

  • currentVersion: The current Minecraft version to migrate from (e.g., "1.20.1")
  • targetVersion: The target Minecraft version to migrate to (e.g., "1.21")

Usage

Add the recipe to your rewrite.yml configuration:

type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.minecraft.migration
displayName: Minecraft Version Migration
recipeList:
  - com.yourorg.MinecraftVersionMigration:
      currentVersion: "1.20.1"
      targetVersion: "1.21"

The tool intelligently identifies version strings that should be updated by checking for common Minecraft-related patterns and contexts, ensuring it doesn't modify unrelated version numbers in your project.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: TimeBather <25410512+TimeBather@users.noreply.github.com>
@TimeBather

Copy link
Copy Markdown
Contributor

@copilot I allowed the access to internal maven source for you, just continue.

Co-authored-by: TimeBather <25410512+TimeBather@users.noreply.github.com>

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown
Author

@copilot I allowed the access to internal maven source for you, just continue.

Thanks for allowing the maven access! I've continued the work and fixed the test failures. The recipe now properly updates version strings in both build.gradle and gradle.properties files, including complex patterns like fabric_version properties and version assignments. All tests are now passing (commit 9ecd760).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • central.sonatype.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/agents/gradle-instrumentation-agent-8.14.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14.3 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] 从样例模板开始,编写一个为 Minecraft 版本迁移工具的代码。 首先,你需要查看,然后删除样例的代码,接着编写一个如下功能: 1. 从rewrite options配置当前项目版本号和目标项目版本号 2. 自�... Implement Minecraft version migration tool using OpenRewrite framework Aug 20, 2025
@TimeBather

Copy link
Copy Markdown
Contributor

@copilot
Please using the real-world scenerio "KuaYue" mod, and migrate it from 1.19.2 to 1.20.1, then found the compile-error of KuaYue, then fix the migrator, reseting the repo of NeoKuaYue, then re-test until the project pass the compile.

Notice 1: You must use the best practices (such as: pass the GuiGraphics into the children insteadof use the direct buffer)

Notice 2: You must to split the test the version folder(e.g. 1.19.2 -> 1.20.1 is the folder "migration1_20_1")

@TimeBather

Copy link
Copy Markdown
Contributor

@copilot
using test of https://github.com/KasugaLibGroup/KasugaLib instead of KuaYue because KuaYue not ready yet.

Please using the real-world scenerio "KasugaLib " mod, and migrate it from 1.19.2 to 1.20.1, then found the compile-error of KuaYue, then fix the migrator, reseting the repo of KasugaLib, then re-test until the project pass the compile.

Notice 1: You must use the best practices (such as: pass the GuiGraphics into the children insteadof use the direct buffer)

Notice 2: You must to split the test the version folder(e.g. 1.19.2 -> 1.20.1 is the folder "migration1_20_1")

@TimeBather

Copy link
Copy Markdown
Contributor

@copilot
Please using the real-world scenerio "KasugaLib " mod, and migrate it from 1.19.2 to 1.20.1, then found the compile-error of KuaYue, then fix the migrator, reseting the repo of KasugaLib, then re-test until the project pass the compile.

Notice 1: You must use the best practices (such as: pass the GuiGraphics into the children insteadof use the direct buffer)

Notice 2: You must to split the test the version folder(e.g. 1.19.2 -> 1.20.1 is the folder "migration1_20_1")

Notice 3: not using the unit test, but {{clone}} a project to local temp dir and migrate it. (Real-world test case)

@TimeBather
TimeBather marked this pull request as ready for review August 20, 2025 01:35
@TimeBather
TimeBather merged commit 30346d4 into main Aug 20, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants